package com.wyh.domain.enums.g3enums;

import com.wyh.domain.po.g3po.BillingItemsEnum;

import java.util.HashMap;
import java.util.Map;

public enum BillTypeEnum {//计费性质


    PERIODIC(0, "周期性计费"),
    THREE_METER(1, "三表类计费"),
    TEMPORARY(2, "临时性计费"),
    DEPOSIT(3, "保证金计费"),
    PREPAID(4, "预存计费");

    private final Integer code;
    private final String description;

    BillTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }



    //查询其中一个
    public static String getByCode(int code) {
        for (BillTypeEnum type : BillTypeEnum.values()) {
            if (type.code == code) {
                return type.getDescription();
            }
        }
        return null;
    }
    //查询所有
    public static Map<Integer, String> getAllBillingTypes() {

        HashMap<Integer, String> hashMap = new HashMap<>();


        for (BillTypeEnum value : BillTypeEnum.values()) {
            hashMap.put(value.getCode(),value.getDescription());
        }
        return hashMap;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
